<%@ taglib prefix="c" uri="jakarta.tags.core" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <base href="<%=request.getContextPath()%>/">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>新闻发布系统后台</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
  <link rel="stylesheet" href="statics/css/newsStyle.css">
</head>
<body>
<!-- 侧边栏 -->
<%@include file="../common/sidebar.jsp"%>
<!-- 主内容区域 -->
<div class="main-content">
  <!-- 顶部导航 -->
  <%@include file="../common/top.jsp"%>
  <!-- 内容区域 -->
  <div class="content">
    <form id="adminEditForm" method="post" action="admin/update" enctype="multipart/form-data">
      <div class="card" style="margin-top: 30px;">
        <h2 class="section-title">编辑管理员</h2>


        <div class="form-group">
          <label for="phone">电话</label>
          <input type="text" id="phone" class="form-control" name="phone"
                 value="${admin.phone}" placeholder="输入联系电话">
        </div>

        <div class="form-group">
          <label>当前头像</label>
          <c:choose>
            <c:when test="${admin.headPic != null && admin.headPic != ''}">
              <img src="statics/images/adminHead/${admin.headPic}" class="edit-avatar" alt="当前头像">
            </c:when>
            <c:otherwise>
              <img src="statics/images/adminHead/admin.png" class="edit-avatar" alt="默认头像">
            </c:otherwise>
          </c:choose>
        </div>

        <div class="form-group">
          <label for="headPic">更换头像</label>
          <input type="file" id="headPic" class="form-control" name="file"
                 accept=".png,.jpg,.gif" placeholder="选择新头像">
          <p class="help-text">不选择则保持原头像</p>
        </div>

        <div style="display: flex; gap: 10px;">
          <button class="btn btn-primary" type="submit" >保存修改</button>
          <a href="admin/find" class="btn btn-default">取消</a>
        </div>
      </div>
    </form>
  </div>
</div>
</body>
</html>